Ext.define('AmpleHarvest.objects.forms.gsApplicationSearch',
{
	extend				: 'Ext.form.Panel',
	alias				: 'widget.ampleharvest-objects-forms-gsapplicationsearch',
	source_name			: 'GS APPLICATION',
	stateful			: false,
	height				: 600,
	requires			:
	[
			'Ext.form.field.Number', 
			'Ext.form.field.Text',
			'Ext.form.FieldSet', 
			'Ext.form.field.Date',
			'AmpleHarvest.elements.combobox.cFacet'
	],

	statics				:
	{
//		C_STR_FIELD_CUSTOMER	: "string.customer",
//		C_STR_FIELD_ORDERMETHOD	: "string.order_method",
//		C_STR_FIELD_PUBLISHDATE	: "publishDate",
		C_STR_FIELD_SOURCE		: "source",
//		C_STR_DATATYPE_DATE  	: "date",
//		C_STR_DATATYPE_VALUE 	: "value"
	},
	uniqueKey		: (((1+Math.random())*0x10000)|0).toString(16).substring(1),
	
	listeners       :
    {
        setValueField : function(str_term)
        {
        	console.log(str_term);
        	Ext.getCmp('valuefield'+this.uniqueKey).searchTerm = str_term;;
        	Ext.getCmp('valuefield'+this.uniqueKey).setDisabled(false);
        }
    },
    
//    dockedItems: [{
//        xtype: 'toolbar',
//        dock: 'top',
//        items: [
//    	Ext.create('Ext.button.Button',
//				{
//					text	: 'Add Facet',
//					scope	: this,
//					handler	: function()
//					{
//						m_obj_AmpleHarvest_ViewPort.mask();
//
//						m_obj_AmpleHarvest_ViewPort
//							.fireEvent(AmpleHarvest.eventHandler.cWindowEvents.C_STR_EVENT_SEARCH_FACET_FORM
//									,Ext.getCmp('ampleHarvest-objects-forms-genewsearch-textarea'+this.str_unique_id)
//									,'/solr-ge-base/');
//					}
//				})
//	]}],
    
	initComponent			: function()
	{
//		this.loadMask = new Ext.LoadMask(this, {});
//		console.log(this.str_unique_id);
		this.m_obj_searchArea = Ext.create('Ext.form.field.Text',
				{
					fieldLabel	: "General",
					id			: 'ampleHarvest-objects-forms-textarea'+this.str_unique_id,
		//			itemId		: 'general',
					name		: "general",
					hiddenName	: "general",
					inputType	: "textfield",
					allowBlank	: true,
					anchor		: "100%"
//			
//			itemId		: 'general',
//			id			: 'ampleHarvest-objects-forms-textarea'+this.str_unique_id,
//			fieldLabel	: 'General',
//			inputType	: "textfield",
//			anchor		: '92%'
		});
		
		this.PublishDateBox = Ext.create("Ext.form.FieldSet",
				{
					title		: "Publish Date",
					collapsible	: true,
					collapsed	: true,
					labelWidth	: 70,
					boxMinWidth	: 275,
					stateId		: 'publish_date',
					stateful	: false

				});

		this.PublishDateBox.add(Ext.create("Ext.form.field.Date",
		{
			fieldLabel	: "Start Date",
			format		: 'Y-m-d H:i:s',
			dataType	: this.self.C_STR_DATATYPE_DATE,
			anchor		: "100%",
			dateTrigger	: 'start',
			itemId		: this.self.C_STR_FIELD_PUBLISHDATE + "_start",
			searchTerm	: this.self.C_STR_FIELD_PUBLISHDATE,
			allowBlank	: true
		}
		));

		this.PublishDateBox.add(Ext.create("Ext.form.field.Date",
		{
			fieldLabel	: "End Date",
			format		: 'Y-m-d H:i:s',
			dataType	: this.self.C_STR_DATATYPE_DATE,
			anchor		: "100%",
			dateTrigger	: 'end',
			itemId		: this.self.C_STR_FIELD_PUBLISHDATE + "_end",
			searchTerm	: this.self.C_STR_FIELD_PUBLISHDATE,
			allowBlank	: true
		}
		));
		
		this.items =
		[
				this.m_obj_searchArea,
				this.PublishDateBox
		];
		this.callParent();
	}
}

);